﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Test30.Tools.Reports
{
    public partial class StatsForm : Form
    {
        public StatsForm()
        {
            InitializeComponent();
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _stats = new AsyncStats();
            _stats.Updated += Stats_Updated;

            statsGrid1.SetStats(_stats.StatRows);

            ClientSize = new Size(statsGrid1.Width + 20, ClientSize.Height);

            _stats.Run();
        }
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            _stats.Updated -= Stats_Updated;
            _stats.Stop();
        }

        void Stats_Updated(object sender, EventArgs e)
        {
            statsGrid1.Invalidate();
        }

        private AsyncStats _stats;

    }
}
